package com.lcifn.spring.aop.advice;

import java.util.Date;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
//@Order(2)
public class AspectJAnnotationArgsBrowserAroundAdvice{

	//@Pointcut("execution(* com.lcifn.spring.aop.bean.ChromeBrowser.*(String,java.util.Date+,..))")
	@Pointcut("execution(* com.lcifn.spring.aop.bean.ChromeBrowser.*(..)) && args(music,date,..)")
	private void pointcut(String music, Date date){
	//private void pointcut(){s
		
	}
	
	//@Around(value="pointcut()")
	@Around(value="pointcut(music,date)")
	public Object aroundIntercept(ProceedingJoinPoint pjp, String music, Date date) throws Throwable{
		//System.out.println("argument:" + music + "," + date);
		encrypt();
		Object retVal  = pjp.proceed();
		decrypt();
		return retVal;
	}
	
	// 加密
	private void encrypt(){
		System.out.println("encrypt ...");
	}
	
	// 解密
	private void decrypt(){
		System.out.println("decrypt ...");
	}

}
